package aspect;

import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.After;
import org.aspectj.lang.annotation.AfterReturning;
import org.aspectj.lang.annotation.AfterThrowing;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;

@Aspect
public class PeopleAspect {
	@Before("execution(* pojo.MoAttack.cityGateAsk(..))")
	public void doBefore(){
		System.out.println("doBefore");
	}
	@After("execution(* pojo.MoAttack.cityGateAsk(..))")
	public void doAfter(){
		System.out.println("doAfter");
	}
	@AfterReturning("execution(* pojo.MoAttack.cityGateAsk(..))")
	public void doAfrerReturning(){
		System.out.println("doAfrerReturning");
	}
	
	@Around("execution(* pojo.MoAttack.cityGateAsk(..))")
	public void doArround(ProceedingJoinPoint JointPoint) throws Throwable{
		System.out.println("doArround:start");
		JointPoint.proceed();
		System.out.println("doArround:end");
	}
	@AfterThrowing("execution(* pojo.MoAttack.cityGateAsk(..))")
	public void doAfterThrowing(JoinPoint jointPoint){
		System.out.println("doAfterThrowing");
	}
	
//	public void doBefore(JoinPoint jointPoint){
//		System.out.println("doBefore:"+jointPoint.toLongString());
//	}
//	public void doAfter(JoinPoint jointPoint){
//		System.out.println("doAfter:"+jointPoint.toLongString());
//	}
//	public Object doArround(ProceedingJoinPoint JointPoint) throws Throwable{
//		System.out.println("doArround:start");
//		Object o = JointPoint.proceed();
//		System.out.println("doArround:end");
//		return 0;
//	}
//	
//	public void doReturning(JoinPoint jointPoint){
//		System.out.println("doReturning:"+jointPoint.toLongString());
//	}
//	public void doThrowing(JoinPoint jointPoint){
//		System.out.println("doThrowing:"+jointPoint.toLongString());
//	}
}
